package cn.com.utt.unms.mapper;

import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import cn.com.utt.unms.pojo.WxCode;

@Mapper
public interface WxCodeMapper {

	@Select("select * from wx_code where cfg_id=#{cfgId} and mac=#{mac}")
	WxCode queryByMac(@Param("cfgId") Long cfgId, @Param("mac") String mac);

	@Select("select * from wx_code where cfg_id=#{cfgId} and code=#{code}")
	List<WxCode> queryWxCode(@Param("cfgId") Long cfgId, @Param("code") String code);

	@Select("update wx_code set status=1,mac=#{mac} where cfg_id=#{cfgId} and openid=#{openId} and status=0")
	void updateWxCode(@Param("cfgId") Long cfgId, @Param("mac") String mac, @Param("openId") String openId);

//	@Select("update  wx_code set status=1 where shop_id>=#{minCfgId} and shop_id<#{maxCfgId} and expire<=#{current}")
//	void updateWxCode(@Param("minCfgId") Long minCfgId, @Param("maxCfgId") Long maxCfgId,
//			@Param("current") Timestamp current);

}